﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace demo03_Path绘制
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Point[] ps = new Point[10];
            ps[0] = new Point(120, 46);
            ps[1] = new Point(156, 46);
            ps[2] = new Point(168, 10);
            ps[3] = new Point(180, 46);
            ps[4] = new Point(214, 46);
            ps[5] = new Point(188, 70);
            ps[6] = new Point(198, 106);
            ps[7] = new Point(168, 82);
            ps[8] = new Point(138, 104);
            ps[9] = new Point(150, 70);

            GraphicsPath path = new GraphicsPath();
            path.AddLines(ps);
            path.CloseFigure();

            Pen p = new Pen(Color.Blue, 5);
            Graphics g = this.CreateGraphics();
            g.DrawPath(p, path);        //使用Path可以大大提升性能
            g.Dispose();
            path.Dispose();
        }
    }
}
